package com.fs.chatx.module.knowledge.api;

import com.fs.chatx.core.api.R;

import com.fs.chatx.module.knowledge.service.MilvusOpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/knowledge")
public class KnowledgeController
{

    @Autowired
    private MilvusOpService milvusService;

    @PostMapping("/import")
    public R importData()
    {
        try
        {
            milvusService.importDataFromJson();
        } catch (Exception e) {
            e.printStackTrace();
            return  R.fail("Error importing data: " + e.getMessage());
        }
       return  R.success("导入成功");
    }

}
